package com.example.blackjack;

import static com.example.blackjack.BlackJack.*;

public class Player {

	protected Deck game;
	protected Deck hand;
	protected int points;
	protected String cards;
	
	public Player(Deck game) {
		this.game = game;
	}
	
	public void init() {
		hand = new Deck();
		points = 0;
		cards = "";
	}
	
	public void start(){
		
	}
	
	public void drawCard() {
		Card c = game.draw(0);
		hand.add(c);
		cards += c.toString() + " ";

		points = 0;
		for(int i = 0; i < hand.getSize(); i++) {
			int rank = hand.get(i).getId() & 0xff;
			points += (rank > 9 ? 10 : rank + 1);
			if(rank == 0) {
				
			}
			//TODO: points/aces
		}
	}
	
	public String getPoints() {
		return "You have: " + cards + "\n" + points + " points";
	}
}
